#pragma once

#include <QTextEdit>
#include <QMimeData>
#include <QTextBlockUserData>

class MyTextEdit  : public QTextEdit
{
	Q_OBJECT

public:
	MyTextEdit(QWidget *parent);
	~MyTextEdit();

	void setPicDirPath(QString path);
	QString toMyPlainText();
	void setMyText(QString text);

signals:
	void sign_msg(QString text);
protected:
	bool canInsertFromMimeData(const QMimeData * source) const;
	bool loadPicFromFile(QString picPath);
	void insertFromMimeData(const QMimeData * source);
	QMimeData * createMimeDataFromSelection() const;
	bool isCopyContentOnlyHasImage(QMimeData * mimeData, QString & picPath) const;

private:
	QString m_picDirPath;
};

class MyBlockUserDate : public QTextBlockUserData
{
public:
	MyBlockUserDate(QString path):filePath(path)
	{

	}
	QString filePath;
};
